package com.shangyitong.exception;

import com.shangyitong.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(HospitalException.class)
    public Result error(HospitalException hospitalException){
        hospitalException.printStackTrace();
        return Result.fail();
    }

    @ExceptionHandler(UserException.class)
    public Result error(UserException userException){
        userException.printStackTrace();
        return Result.fail();
    }
}
